import {ajax, get, post} from '@/utils/request.js'

/**
 * 获取验证码
 * @param {Object} phone
 */
export function captcha(phone) {
	return get(`member/security/captcha/${phone}`)
}

/**
 * 微信登录
 * @param {Object} data
 */
export function weixinLogin(data) {
	return post('member/security/weixin/login', data, {showError: false})
}

/**
 * 微信注册登录
 * @param {Object} data
 */
export function weixinRegister(data) {
	return post('member/security/weixin/register', data)
}

/**
 * 登录
 * @param {Object} data
 */
export function login(data) {
	return get(`member/security/captcha/${data.cellphone}/login`, data)
}

/**
 * 获取用户信息
 */
export function userInfo() {
	return get('member/info', {}, {showError: false})
}